<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>作业15</title>
    <script>
        /*
        15.  将数组中值为 0 的项去掉，将不为 0 的值存入一个新的数组，生成新的数组。
        */
        
        var arr = [1,2,4,0,6,5,0,3];

        var arr2 = [];

        for(var i=0; i<arr.length; i++) {
            if(arr[i] != 0){
                arr2.push(arr[i]);
            }
        }

        console.log(arr2);

    </script>
</head>
<body>
    
</body>
</html>